#!/usr/bin/python
# -*- coding: utf-8 -*-


class Dog(object):#父类定义一个方法
    def work(self):
        print('zhinadana........')

class ArmyDog(Dog):#子类重写父类方法
    def work(self):
        print('追击敌人')

class DrunDog(Dog):
    def work(self):
        print('缉毒......')

class Person(object):
    def work_with_dog(self, dog):#传入不同的对象，执行不同的代码
        dog.work()

if __name__ == '__main__':
    ad = ArmyDog()
    dd = DrunDog()
    result = Person()
    re = result.work_with_dog(ad)
    re = result.work_with_dog(dd)